package jzOffer;

public class Num04 {
    public boolean findNumberIn2DArray(int[][] matrix, int target) {
        int n=matrix.length;
        if(n==0 ) return false;

        for(int i=0;i<n;i++){
            int low=0;
            int high=matrix[i].length-1;
            while(low<= high){
                int mid=low+(high-low)/2;
                if(matrix[i][mid]>target){
                    high=mid-1;
                }else if(matrix[i][mid]==target){
                    return true;
                }else{
                    low=mid+1;
                }
            }
        }
        return false;
    }
}
